package com.zero.yygh.oss.controller;

import com.zero.yygh.common.result.Result;
import com.zero.yygh.oss.service.FileService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author zero
 * @desc 文件上传api
 * @create 2021/4/12
 */
@Api("文件上传Api")
@RestController
@RequestMapping("/api/oss/file")
public class FileApiController {

    @Resource
    private FileService fileService;

    @PostMapping("fileUpload")
    public Result<Object> file(MultipartFile file){
        String url = fileService.upload(file);
        return Result.ok(url);
    }

}
